<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>改变行的内容</title>
</head>

<body>
    <table id="myTable" border="1">
        <tr>
            <td colspan="4">单元格 1</td>
            <td colspan="4">单元格 3</td>
        </tr>
        <tr>
            <td>单元格 3</td>
            <td>单元格 4</td>
            <td>单元格 5</td>
            <td>单元格 6</td>
            <td>单元格 7</td>
            <td>单元格 8</td>
            <td>单元格 9</td>
            <td>单元格 10</td>
        </tr>
    </table>
    <form>
        <input type="button" onclick="setColSpan()" value="修改合并列">
    </form>
    <script>
        function setColSpan() {
            var x = document.getElementById('myTable').rows[0].cells;
            x[0].colSpan = "2";
            x[1].colSpan = "6";
        }
    </script>
</body>

</html>